package com.xinsilu.hospital.controller;


import com.xinsilu.common.Result;
import com.xinsilu.hospital.entity.DepartmentTable;
import com.xinsilu.hospital.service.IDepartmentTableService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author ym
 * @since 2021-09-22
 */
@RestController
@RequestMapping("/api/hospital/departmentTable")
public class DepartmentTableController {

    @Autowired

    private IDepartmentTableService iDepartmentTableService;

    @RequestMapping("/kssousuo")
    public Object sousuo() {
        List<DepartmentTable> list = iDepartmentTableService.list();
        return Result.ok(list);

    }


    @RequestMapping("/add")
    public Object add(DepartmentTable departmentTable){
        boolean count = iDepartmentTableService.save(departmentTable);
        if (count) {
            return Result.ok("新增成功");
        }
        return Result.ok("异常");


    }
    @RequestMapping("getList")
    public  Object getList(){
        List<DepartmentTable> list = iDepartmentTableService.getList();
        return  Result.ok(list);
    }


    }



